/*
 * Copyright (c) csii.com.cn 2016 zhaojin
 */

package com.csii.ssm.listener;
import org.springframework.context.ApplicationContextException;
import org.springframework.util.ClassUtils;
import org.springframework.web.context.ContextLoaderListener;

import javax.servlet.ServletContext;

public class MyContextLoaderListener extends ContextLoaderListener {

    private String contextClassName;

    @Override
    protected Class<?> determineContextClass(ServletContext servletContext) {
        contextClassName = servletContext.getInitParameter("contextClassName");
        try {
            return ClassUtils.forName(contextClassName, ClassUtils.getDefaultClassLoader());
        } catch (ClassNotFoundException var4) {
            throw new ApplicationContextException("Failed to load custom context class [" + contextClassName + "]", var4);
        }
    }
}
